/* GUI CONVERTED from rcrp05.p (converter v1.76) Wed May 29 12:00:55 2002 */
/* rcrp05.p -  CUSTOMER SEQUENCE SCHEDULE REPORT                              */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.37 $                                                          */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 9.1          CREATED: 07/07/99     BY: *N003* Dan Herman         */
/* REVISION: 9.1    LAST MODIFIED: 01/14/00     BY: *N076* Dan Herman         */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00     BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1    LAST MODIFIED: 07/25/00     BY: *N0GQ* BalbeerS Rajput    */
/* Revision: 1.35     BY: Jean Miller         DATE: 03/22/01  ECO: *P008*     */
/* Revision: 1.36     BY: Katie Hilbert       DATE: 04/15/02  ECO: *P03J*     */
/* $Revision: 1.37 $    BY: Katie Hilbert       DATE: 05/16/02  ECO: *P06T*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/*                                                                          */
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */
/*         THIS PROGRAM IS A BOLT-ON TO STANDARD PRODUCT MFG/PRO.           */
/* ANY CHANGES TO THIS PROGRAM MUST BE PLACED ON A SEPARATE ECO THAN        */
/* STANDARD PRODUCT CHANGES.  FAILURE TO DO THIS CAUSES THE BOLT-ON CODE TO */
/* BE COMBINED WITH STANDARD PRODUCT AND RESULTS IN PATCH DELIVERY FAILURES.*/
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define variable shipfrom_from     like rcs_shipfrom  no-undo.
define variable shipfrom_to       like rcs_shipfrom  no-undo.
define variable shipto_from       like rcs_shipto    no-undo.
define variable shipto_to         like rcs_shipto    no-undo.
define variable rlseid_from       like rcsd_rlse_id  no-undo.
define variable rlseid_to         like rcsd_rlse_id  no-undo.
define variable custjob_from      like rcsd_cust_job no-undo.
define variable custjob_to        like rcsd_cust_job no-undo.
define variable custseq_from      like rcsd_cust_seq no-undo.
define variable custseq_to        like rcsd_cust_seq no-undo.
define variable custref_from      like rcsd_custref  no-undo
                                  label "Line Item Cust Ref".
define variable custref_to        like rcsd_custref  no-undo.
define variable modelyr_from      like rcsd_modelyr  no-undo.
define variable modelyr_to        like rcsd_modelyr  no-undo.
define variable cust_ref_from     like rcsd_cust_ref no-undo.
define variable cust_ref_to       like rcsd_cust_ref no-undo.
define variable part_from         like rcsd_part     no-undo.
define variable part_to           like rcsd_part     no-undo.
define variable po_from           like rcsd_cust_po  no-undo.
define variable po_to             like rcsd_cust_po  no-undo.
define variable order_from        like rcsd_order    no-undo.
define variable order_to          like rcsd_order    no-undo.
define variable status_from       like rcsd_status   no-undo.
define variable status_to         like rcsd_status   no-undo.
define variable date_from         like rcsd_date     no-undo
                                  label "Ship/Delivery Date".
define variable date_to           like rcsd_date     no-undo.
define variable time_from         like rcsd_time     no-undo.
define variable time_to           like rcsd_time     no-undo.
define variable active_sched      like mfc_logical   no-undo
                                  label "Active/History"
                                  format "Active/History" initial yes.
define variable l_details         like mfc_logical label "Details" no-undo.
define variable l_subtotals       like mfc_logical label "Sub-Totals" no-undo.
define variable dt_from           as date             no-undo.
define variable dt_to             as date             no-undo.
define variable l_pt_desc         like pt_desc1       no-undo.
define variable l_pt_um           like pt_um          no-undo.
define variable l_total_discr_qty like rcsd_cum_qty   no-undo.
define variable l_ship_id         like abss_ship_id   no-undo.
define variable l_seq_option      as integer format 9 no-undo
                                  label "Include Sequences" initial 1.
define variable l_seq_option_desc as character format "x(50)" no-undo.
define variable incl_deleted      like mfc_logical no-undo.

define temp-table tt-sub-totals
   field tt-shipfrom like rcsd_shipfrom
   field tt-shipto   like rcsd_shipto
   field tt-rlse-id  like rcsd_rlse_id
   field tt-cust-job like rcsd_cust_job
   field tt-cust-seq like rcsd_cust_seq
   field tt-part     like rcsd_part
   field tt-date     like rcsd_date
   field tt-time     like rcsd_time
   field tt-cust-ref like rcsd_cust_ref
   field tt-pt-desc  like pt_desc1
   field tt-discr-qty like rcsd_discr_qty
   field tt-um       like pt_um
index tt-index1 is primary
   tt-shipfrom tt-shipto tt-rlse-id tt-cust-job tt-cust-seq
   tt-part tt-date tt-time tt-cust-ref ascending
index tt-index2
   tt-shipfrom tt-shipto
   tt-rlse-id tt-date tt-part ascending.

define temp-table tt-prnt-sub
   field tt-prnt-date like rcsd_date
   field tt-prnt-part like rcsd_part
   field tt-prnt-desc like pt_desc1
   field tt-prnt-discr-qty  like rcsd_discr_qty
   field tt-prnt-um   like pt_um
index tt-prnt-index tt-prnt-date tt-prnt-part.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
shipfrom_from      colon 20
   shipfrom_to        colon 45 label {t001.i}
   shipto_from        colon 20
   shipto_to          colon 45 label {t001.i}
   rlseid_from        colon 20                view-as fill-in size 20 by 1
   rlseid_to          colon 45 label {t001.i} view-as fill-in size 20 by 1
   custjob_from       colon 20                view-as fill-in size 20 by 1
   custjob_to         colon 45 label {t001.i} view-as fill-in size 20 by 1
   custseq_from       colon 20                view-as fill-in size 20 by 1
   custseq_to         colon 45 label {t001.i} view-as fill-in size 20 by 1
   custref_from       colon 20                view-as fill-in size 20 by 1
   custref_to         colon 45 label {t001.i} view-as fill-in size 20 by 1
   modelyr_from       colon 20                view-as fill-in size 20 by 1
   modelyr_to         colon 45 label {t001.i} view-as fill-in size 20 by 1
   cust_ref_from      colon 20                view-as fill-in size 20 by 1
   cust_ref_to        colon 45 label {t001.i} view-as fill-in size 20 by 1
   part_from          colon 20
   part_to            colon 45 label {t001.i}
   order_from         colon 20
   order_to           colon 45 label {t001.i}
   po_from            colon 20                view-as fill-in size 20 by 1
   po_to              colon 45 label {t001.i} view-as fill-in size 20 by 1
   status_from        colon 20
   status_to          colon 45 label {t001.i}
   date_from          colon 20
   time_from          no-label
   date_to            colon 45 label {t001.i}
   time_to            no-label
   active_sched       colon 20
   l_seq_option       colon 20
   l_seq_option_desc  no-label
   incl_deleted       colon 20 label "Include Deleted"
   l_details          colon 20
   l_subtotals        colon 45
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp01.i}

l_seq_option_desc = "1-"   + getTermLabel("ALL",5)
                  + ", 2-" + getTermLabel("PICKED_ONLY",15)
                  + ", 3-" + getTermLabel("UNPICKED_ONLY",19).

repeat with frame a:

   display
      l_seq_option_desc.

   if shipfrom_to = hi_char then shipfrom_to = "".
   if shipto_to   = hi_char then shipto_to   = "".
   if rlseid_to   = hi_char then rlseid_to   = "".
   if custjob_to  = hi_char then custjob_to  = "".
   if custseq_to  = hi_char then custseq_to  = "".
   if custref_to  = hi_char then custref_to  = "".
   if modelyr_to  = hi_char then modelyr_to  = "".
   if cust_ref_to = hi_char then cust_ref_to = "".
   if part_to     = hi_char then part_to     = "".
   if time_to     = hi_char then time_to     = "".
   if dt_from     = low_date then date_from  = ?.
   if dt_to       = hi_date then date_to     = ?.
   if order_to    = hi_char then order_to    = "".
   if po_to       = hi_char then po_to       = "".
   if status_to   = hi_char then status_to   = "".

   if c-application-mode <> "WEB" then
   update
      shipfrom_from
      shipfrom_to
      shipto_from
      shipto_to
      rlseid_from
      rlseid_to
      custjob_from
      custjob_to
      custseq_from
      custseq_to
      custref_from
      custref_to
      modelyr_from
      modelyr_to
      cust_ref_from
      cust_ref_to
      part_from
      part_to
      order_from
      order_to
      po_from
      po_to
      status_from
      status_to
      date_from
      time_from
      date_to
      time_to
      active_sched
      l_seq_option
      incl_deleted
      l_details
      l_subtotals
   with frame a.

   {wbrp06.i &command = update &fields = "
                    shipfrom_from shipfrom_to shipto_from shipto_to
                    rlseid_from rlseid_to custjob_from custjob_to
                    custseq_from custseq_to custref_from custref_to
                    modelyr_from modelyr_to cust_ref_from cust_ref_to
                    part_from part_to order_from order_to
                    po_from po_to status_from status_to
                    date_from time_from date_to time_to
                    active_sched l_seq_option incl_deleted
                    l_details l_subtotals"
      &frm = "a"}

   if index("123",string(l_seq_option)) = 0 then do:
      /* Invalid Include Option */
      {pxmsg.i &MSGNUM=3406 &ERRORLEVEL=3}
      if c-application-mode = "WEB" then
         return.
      else do:
         next-prompt l_seq_option with frame a.
         undo, retry.
      end.
   end.  /* if index("123", string(l_seq_option)) = 0 */

   if (c-application-mode <> "WEB") or
      (c-application-mode = "WEB" and
      (c-web-request begins 'data')) then do:

      bcdparm = "".
      {mfquoter.i shipfrom_from }
      {mfquoter.i shipfrom_to   }
      {mfquoter.i shipto_from   }
      {mfquoter.i shipto_to     }
      {mfquoter.i rlseid_from   }
      {mfquoter.i rlseid_to     }
      {mfquoter.i custjob_from  }
      {mfquoter.i custjob_to    }
      {mfquoter.i custseq_from  }
      {mfquoter.i custseq_to    }
      {mfquoter.i custref_from  }
      {mfquoter.i custref_to    }
      {mfquoter.i modelyr_from  }
      {mfquoter.i modelyr_to    }
      {mfquoter.i cust_ref_from }
      {mfquoter.i cust_ref_to   }
      {mfquoter.i part_from     }
      {mfquoter.i part_to       }
      {mfquoter.i order_from    }
      {mfquoter.i order_to      }
      {mfquoter.i po_from       }
      {mfquoter.i po_to         }
      {mfquoter.i status_from   }
      {mfquoter.i status_to     }
      {mfquoter.i date_from     }
      {mfquoter.i time_from     }
      {mfquoter.i date_to       }
      {mfquoter.i time_to       }
      {mfquoter.i active_sched  }
      {mfquoter.i l_seq_option  }
      {mfquoter.i incl_deleted  }
      {mfquoter.i l_details     }
      {mfquoter.i l_subtotals   }

      if shipfrom_to = "" then shipfrom_to = hi_char.
      if shipto_to   = "" then shipto_to   = hi_char.
      if rlseid_to   = "" then rlseid_to   = hi_char.
      if custjob_to  = "" then custjob_to  = hi_char.
      if custseq_to  = "" then custseq_to  = hi_char.
      if custref_to  = "" then custref_to  = hi_char.
      if modelyr_to  = "" then modelyr_to  = hi_char.
      if cust_ref_to = "" then cust_ref_to = hi_char.
      if part_to     = "" then part_to     = hi_char.
      if order_to    = "" then order_to    = hi_char.
      if po_to       = "" then po_to       = hi_char.
      if status_to   = "" then status_to   = hi_char.
      if time_to     = "" then time_to     = hi_char.

   end.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "yes"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   {mfphead.i}

   if date_from = ? then
      dt_from = low_date.
   else
      dt_from = date_from.

   if date_to = ? then
      dt_to = hi_date.
   else
      dt_to = date_to.

   for each tt-sub-totals exclusive-lock:
      delete tt-sub-totals.
   end.

   for each tt-prnt-sub exclusive-lock:
      delete tt-prnt-sub.
   end.

   l_total_discr_qty = 0.

   if active_sched then do:
      for each rcs_mstr no-lock where
               rcs_shipfrom >= shipfrom_from and rcs_shipfrom <= shipfrom_to
           and rcs_shipto >= shipto_from and rcs_shipto <= shipto_to
           and rcs_rlse_id >= rlseid_from and rcs_rlse_id <= rlseid_to
           and rcs_active
      break by rcs_shipfrom
            by rcs_shipto
            by rcs_rlse_id:

         run print_header
            (input rcs_shipfrom,
             input rcs_shipto,
             input rcs_rlse_id,
             input dt_from,
             input dt_to,
             input time_from,
             input time_to,
             input custjob_from,
             input custjob_to,
             input custseq_from,
             input custseq_to,
             input custref_from,
             input custref_to,
             input modelyr_from,
             input modelyr_to,
             input cust_ref_from,
             input cust_ref_to,
             input part_from,
             input part_to,
             input order_from,
             input order_to,
             input po_from,
             input po_to,
             input status_from,
             input status_to).

         run print_details
            (input rcs_shipfrom,
             input rcs_shipto,
             input rcs_rlse_id,
             input dt_from,
             input dt_to,
             input time_from,
             input time_to,
             input custjob_from,
             input custjob_to,
             input custseq_from,
             input custseq_to,
             input custref_from,
             input custref_to,
             input modelyr_from,
             input modelyr_to,
             input cust_ref_from,
             input cust_ref_to,
             input part_from,
             input part_to,
             input order_from,
             input order_to,
             input po_from,
             input po_to,
             input status_from,
             input status_to,
             input rcs_cumulative,
             input incl_deleted,
             input l_details,
             input l_seq_option).

         if l_subtotals then
            run print_subtotals
               (input rcs_shipfrom,
                input rcs_shipto,
                input rcs_rlse_id,
                input false).

         page.

      end. /* FOR EACH RCS_MSTR */

   end. /* IF ACTIVE_SCHED */

   else do: /* HISTORY */

      for each rcs_mstr no-lock where
               rcs_shipfrom >= shipfrom_from and rcs_shipfrom <= shipfrom_to
           and rcs_shipto >= shipto_from and rcs_shipto <= shipto_to
           and rcs_rlse_id >= rlseid_from and rcs_rlse_id <= rlseid_to
      break by rcs_shipfrom
            by rcs_shipto
            by rcs_rlse_id:

         run print_header
            (input rcs_shipfrom,
             input rcs_shipto,
             input rcs_rlse_id,
             input dt_from,
             input dt_to,
             input time_from,
             input time_to,
             input custjob_from,
             input custjob_to,
             input custseq_from,
             input custseq_to,
             input custref_from,
             input custref_to,
             input modelyr_from,
             input modelyr_to,
             input cust_ref_from,
             input cust_ref_to,
             input part_from,
             input part_to,
             input order_from,
             input order_to,
             input po_from,
             input po_to,
             input status_from,
             input status_to).

         run print_details
            (input rcs_shipfrom,
             input rcs_shipto,
             input rcs_rlse_id,
             input dt_from,
             input dt_to,
             input time_from,
             input time_to,
             input custjob_from,
             input custjob_to,
             input custseq_from,
             input custseq_to,
             input custref_from,
             input custref_to,
             input modelyr_from,
             input modelyr_to,
             input cust_ref_from,
             input cust_ref_to,
             input part_from,
             input part_to,
             input order_from,
             input order_to,
             input po_from,
             input po_to,
             input status_from,
             input status_to,
             input rcs_cumulative,
             input incl_deleted,
             input l_details,
             input l_seq_option).

         if l_subtotals then
            run print_subtotals
               (input rcs_shipfrom,
                input rcs_shipto,
                input rcs_rlse_id,
                input false).

         page.

      end. /* FOR EACH RCS_MSTR */

   end.  /* ELSE DO HISTORY */

   for first tt-sub-totals no-lock:
      if l_subtotals then
         run print_subtotals
            (input rcs_shipfrom,
             input rcs_shipto,
             input rcs_rlse_id,
             input true).
   end.

   /* REPORT TRAILER */
   {mfrtrail.i}

end.

{wbrp04.i &frame-spec = a}

PROCEDURE print_header:
/*--------------------------------------------------------------------
  Purpose:
  Parameters:
  Notes:
 ----------------------------------------------------------------------*/
   define input parameter ip_from         like rcs_shipfrom  no-undo.
   define input parameter ip_to           like rcs_shipto    no-undo.
   define input parameter ip_rlse         like rcs_rlse_id   no-undo.
   define input parameter ip_datefrom     like rcsd_date     no-undo.
   define input parameter ip_dateto       like rcsd_date     no-undo.
   define input parameter ip_timefrom     like rcsd_time     no-undo.
   define input parameter ip_timeto       like rcsd_time     no-undo.
   define input parameter ip_custjobfrom  like rcsd_cust_job no-undo.
   define input parameter ip_custjobto    like rcsd_cust_job no-undo.
   define input parameter ip_custseqfrom  like rcsd_cust_seq no-undo.
   define input parameter ip_custseqto    like rcsd_cust_seq no-undo.
   define input parameter ip_custreffrom  like rcsd_custref  no-undo.
   define input parameter ip_custrefto    like rcsd_custref  no-undo.
   define input parameter ip_modelyrfrom  like rcsd_modelyr  no-undo.
   define input parameter ip_modelyrto    like rcsd_modelyr  no-undo.
   define input parameter ip_cust_reffrom like rcsd_cust_ref no-undo.
   define input parameter ip_cust_refto   like rcsd_cust_ref no-undo.
   define input parameter ip_partfrom     like rcsd_part     no-undo.
   define input parameter ip_partto       like rcsd_part     no-undo.
   define input parameter ip_orderfrom    like rcsd_order    no-undo.
   define input parameter ip_orderto      like rcsd_order    no-undo.
   define input parameter ip_pofrom       like rcsd_cust_po  no-undo.
   define input parameter ip_poto         like rcsd_cust_po  no-undo.
   define input parameter ip_statusfrom   like rcsd_status   no-undo.
   define input parameter ip_statusto     like rcsd_status   no-undo.

   define variable l_from_name  like ad_name no-undo.
   define variable l_cust_name  like ad_name no-undo.
   define variable l_cust_id    like cm_addr no-undo.
   define variable l_to_name    like ad_name no-undo.
   define variable l_shipto_ref like ad_ref  no-undo.

   define buffer bf_mstr for rcs_mstr.

   FORM /*GUI*/ 
      bf_mstr.rcs_shipfrom            colon 15
      l_from_name                     no-label
      l_cust_id                       colon 15
      l_cust_name                     no-label
      bf_mstr.rcs_shipto              colon 15
      l_to_name                       no-label
      bf_mstr.rcs_rlse_id             colon 15
      bf_mstr.rcs_active              colon 60
      skip (1)
      bf_mstr.rcs_date_type           colon 20
      bf_mstr.rcs_cr_date             colon 80
      bf_mstr.rcs_cr_time             at 95 no-label
      bf_mstr.rcs_active_start        colon 20
      bf_mstr.rcs_active_end          colon 50
      bf_mstr.rcs_packing_order       colon 80
      bf_mstr.rcs_cumulative          colon 20
      bf_mstr.rcs_seq_per_container   colon 80
      bf_mstr.rcs_check_seq_tol       colon 34
      bf_mstr.rcs_max_tol             colon 80
   with STREAM-IO /*GUI*/  frame hdr side-labels width 132 attr-space.

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame hdr:handle).

   if can-find( first rcsd_det where
          rcsd_shipfrom = ip_from
      and rcsd_shipto   = ip_to
      and rcsd_rlse_id  = ip_rlse
      and rcsd_date >= ip_datefrom and rcsd_date <= ip_dateto
      and rcsd_time >= ip_timefrom and rcsd_time <= ip_timeto
      and rcsd_cust_job >= ip_custjobfrom
      and rcsd_cust_job <= ip_custjobto
      and rcsd_cust_seq >= ip_custseqfrom
      and rcsd_cust_seq <= ip_custseqto
      and rcsd_custref  >= ip_custreffrom
      and rcsd_custref  <= ip_custrefto
      and rcsd_modelyr  >= ip_modelyrfrom
      and rcsd_modelyr  <= ip_modelyrto
      and rcsd_cust_ref >= ip_cust_reffrom
      and rcsd_cust_ref <= ip_cust_refto
      and rcsd_status   >= ip_statusfrom
      and rcsd_status   <= ip_statusto
      and rcsd_cust_po  >= ip_pofrom and rcsd_cust_po <= ip_poto
      and rcsd_order    >= ip_orderfrom and rcsd_order <= ip_orderto
      and rcsd_part     >= ip_partfrom and rcsd_part <= ip_partto)
   then do:

      for first si_mstr where
                si_site = ip_from
      no-lock:
         l_from_name = si_desc.
      end.

      for first ad_mstr
         where ad_addr = ip_to
      no-lock: end.

      assign
         l_cust_id    = ad_addr
         l_cust_name  = ad_name
         l_to_name    = ad_name
         l_shipto_ref = ad_ref.

      if ad_type = "dock" or
         ad_type = "ship-to"
      then do:
         for first ad_mstr
             where ad_addr = l_shipto_ref
         no-lock:
            assign
               l_cust_id = ad_addr
               l_cust_name = ad_name.
         end.
      end.

      for first bf_mstr no-lock where
                bf_mstr.rcs_shipfrom = ip_from
            and bf_mstr.rcs_shipto   = ip_to
            and bf_mstr.rcs_rlse_id  = ip_rlse:
      end.

      display
         bf_mstr.rcs_shipfrom
         l_from_name
         l_cust_id
         l_cust_name
         bf_mstr.rcs_shipto
         l_to_name
         bf_mstr.rcs_rlse_id
         bf_mstr.rcs_active
         bf_mstr.rcs_date_type
         bf_mstr.rcs_cr_date
         bf_mstr.rcs_cr_time
         bf_mstr.rcs_active_start
         bf_mstr.rcs_active_end
         bf_mstr.rcs_cumulative
         bf_mstr.rcs_packing_order
         bf_mstr.rcs_seq_per_container
         bf_mstr.rcs_check_seq_tol
         bf_mstr.rcs_max_tol
      with frame hdr STREAM-IO /*GUI*/ .
      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

   end.
END PROCEDURE. /*PRINT_HEADER*/

PROCEDURE print_details:
/*--------------------------------------------------------------------
  Purpose:
  Parameters:
  Notes:
 ----------------------------------------------------------------------*/
   define input parameter ip_det_from      like rcs_shipfrom  no-undo.
   define input parameter ip_det_to        like rcs_shipto    no-undo.
   define input parameter ip_det_rlse      like rcs_rlse_id   no-undo.
   define input parameter ip_date_from     like rcsd_date     no-undo.
   define input parameter ip_date_to       like rcsd_date     no-undo.
   define input parameter ip_time_from     like rcsd_time     no-undo.
   define input parameter ip_time_to       like rcsd_time     no-undo.
   define input parameter ip_custjob_from  like rcsd_cust_job no-undo.
   define input parameter ip_custjob_to    like rcsd_cust_job no-undo.
   define input parameter ip_custseq_from  like rcsd_cust_seq no-undo.
   define input parameter ip_custseq_to    like rcsd_cust_seq no-undo.
   define input parameter ip_custref_from  like rcsd_custref  no-undo.
   define input parameter ip_custref_to    like rcsd_custref  no-undo.
   define input parameter ip_modelyr_from  like rcsd_modelyr  no-undo.
   define input parameter ip_modelyr_to    like rcsd_modelyr  no-undo.
   define input parameter ip_cust_ref_from like rcsd_cust_ref no-undo.
   define input parameter ip_cust_ref_to   like rcsd_cust_ref no-undo.
   define input parameter ip_part_from     like rcsd_part     no-undo.
   define input parameter ip_part_to       like rcsd_part     no-undo.
   define input parameter ip_order_from    like rcsd_order    no-undo.
   define input parameter ip_order_to      like rcsd_order    no-undo.
   define input parameter ip_po_from       like rcsd_cust_po  no-undo.
   define input parameter ip_po_to         like rcsd_cust_po  no-undo.
   define input parameter ip_status_from   like rcsd_status   no-undo.
   define input parameter ip_status_to     like rcsd_status   no-undo.
   define input parameter ip_cumulative    like mfc_logical   no-undo.
   define input parameter ip_deleted       like rcsd_delete   no-undo.
   define input parameter ip_details       like mfc_logical   no-undo.
   define input parameter ip_seq_option    like l_seq_option  no-undo.

   define variable date_printed like mfc_logical initial false no-undo.

   FORM /*GUI*/ 
      rcsd_cust_job   column-label "Customer Job!Customer Sequence"
      rcsd_part       column-label "Item!Status"
      l_pt_um
      rcsd_order      column-label "Order!Line!Model Yr"
      rcsd_cust_po    column-label "PO Number!Customer Ref!Line Item Cust Ref"
                      view-as fill-in size 20 by 1
      rcsd_dock       column-label "Customer Dock!Line Feed"
                      view-as fill-in size 20 by 1
      rcsd_discr_qty  column-label "Quantity!Cum Quantity"
      rcsd_deleted    column-label "Delete"
   with STREAM-IO /*GUI*/  frame rcsd-details down width 132.

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame rcsd-details:handle).

   for each rcsd_det no-lock
      where rcsd_shipfrom = ip_det_from
        and rcsd_shipto   = ip_det_to
        and rcsd_rlse_id  = ip_det_rlse
        and rcsd_date >= ip_date_from and rcsd_date <= ip_date_to
        and rcsd_time >= ip_time_from and rcsd_time <= ip_time_to
        and rcsd_cust_job >= ip_custjob_from
        and rcsd_cust_job <= ip_custjob_to
        and rcsd_cust_seq >= ip_custseq_from
        and rcsd_cust_seq <= ip_custseq_to
        and rcsd_custref  >= ip_custref_from
        and rcsd_custref  <= ip_custref_to
        and rcsd_modelyr  >= ip_modelyr_from
        and rcsd_modelyr  <= ip_modelyr_to
        and rcsd_cust_ref >= ip_cust_ref_from
        and rcsd_cust_ref <= ip_cust_ref_to
        and rcsd_part >= ip_part_from and rcsd_part <= ip_part_to
        and rcsd_status >= ip_status_from
        and rcsd_status <= ip_status_to
        and rcsd_cust_po >= ip_po_from and rcsd_cust_po <= ip_po_to
        and rcsd_order >= ip_order_from
        and rcsd_order <= ip_order_to
        and ((ip_seq_option = 1) or
         (ip_seq_option = 2 and (rcsd_picked or rcsd_x_referenced)) or
         (ip_seq_option = 3 and (not rcsd_picked and
         not rcsd_x_referenced)))
   use-index rcsd_index2
   break by rcsd_date
         by rcsd_time
   with frame rcsd-details down:

      if not ip_deleted and rcsd_delete then next.

      for first pt_mstr
         fields (pt_um pt_desc1)
         where pt_part = rcsd_part
      no-lock: end. /* FOR FIRST PT_MSTR */

      if available pt_mstr then
         assign
            l_pt_desc = pt_desc1
            l_pt_um = pt_um.
      else
         assign
            l_pt_desc = ""
            l_pt_um = "".

      create tt-sub-totals.
      assign
         tt-shipfrom  = rcsd_shipfrom
         tt-shipto    = rcsd_shipto
         tt-rlse-id   = rcsd_rlse_id
         tt-cust-job  = rcsd_cust_job
         tt-cust-seq  = rcsd_cust_seq
         tt-part      = rcsd_part
         tt-date      = rcsd_date
         tt-time      = rcsd_time
         tt-cust-ref  = rcsd_cust_ref
         tt-pt-desc   = l_pt_desc
         tt-discr-qty = rcsd_discr_qty
         tt-um        = l_pt_um.

      if recid(tt-sub-totals) = -1 then.

      if ip_details then do:
         if rcsd_picked then
            for first abss_det
                where abss_shipfrom  = rcsd_shipfrom
                  and abss_shipto    = rcsd_shipto
                  and abss_rlse_id   = rcsd_rlse_id
                  and abss_cust_job  = rcsd_cust_job
                  and abss_cust_seq  = rcsd_cust_seq
                  and abss_part      = rcsd_part
                  and abss_date      = rcsd_date
                  and abss_time      = rcsd_time
                  and abss_cust_ref  = rcsd_cust_ref
                  and abss_dock      = rcsd_dock
                  and abss_line_feed = rcsd_line_feed
            no-lock: end.

         if rcsd_x_referenced then
            for first rcsx_ref
                where rcsx_shipfrom  = rcsd_shipfrom
                  and rcsx_shipto    = rcsd_shipto
                  and rcsx_rlse_id   = rcsd_rlse_id
                  and rcsx_cust_job  = rcsd_cust_job
                  and rcsx_cust_seq  = rcsd_cust_seq
                  and rcsx_part      = rcsd_part
                  and rcsx_date      = rcsd_date
                  and rcsx_time      = rcsd_time
                  and rcsx_cust_ref  = rcsd_cust_ref
                  and rcsx_dock      = rcsd_dock
                  and rcsx_line_feed = rcsd_line_feed
            no-lock: end. /*FOR FIRST RCSX_REF*/

      end. /*IF IP_DETAILS*/

      if first-of(rcsd_time) or not date_printed then do:

         put
            skip(1)
            {gplblfmt.i
               &FUNC=getTermLabel(""DATE"",6)
               &CONCAT="': '"} at 5
            rcsd_date
            rcsd_time at 23.

         date_printed = true.

      end.  /* if first-of(rcsd_time) */

      if last-of(rcsd_time) then
         date_printed = false.

      if ip_cumulative then do:

         display
            rcsd_cust_job
            rcsd_part
            l_pt_um
            rcsd_order
            rcsd_cust_po
            rcsd_dock
            rcsd_discr_qty
            rcsd_deleted WITH STREAM-IO /*GUI*/ .

         down 1.

         display
            rcsd_cust_seq     @ rcsd_cust_job
            string(rcsd_line) @ rcsd_order
            rcsd_cust_ref     @ rcsd_cust_po
            rcsd_status       @ rcsd_part
            rcsd_line_feed    @ rcsd_dock
            rcsd_cum_qty      @ rcsd_discr_qty WITH STREAM-IO /*GUI*/ .

         down 1.
         display
            rcsd_modelyr      @ rcsd_order
            rcsd_custref      @ rcsd_cust_po WITH STREAM-IO /*GUI*/ .

      end.

      else do:

         display
            rcsd_cust_job
            rcsd_part
            l_pt_um
            rcsd_order
            rcsd_cust_po
            rcsd_dock
            rcsd_discr_qty
            rcsd_delete WITH STREAM-IO /*GUI*/ .

         down 1.

         display
            rcsd_cust_seq     @ rcsd_cust_job
            string(rcsd_line) @ rcsd_order
            rcsd_cust_ref     @ rcsd_cust_po
            rcsd_status       @ rcsd_part
            rcsd_line_feed    @ rcsd_dock WITH STREAM-IO /*GUI*/ .

         down 1.
         display
            rcsd_modelyr      @ rcsd_order
            rcsd_custref      @ rcsd_cust_po WITH STREAM-IO /*GUI*/ .

      end.

      down 2.

      if ip_details then do:

         if rcsd_picked then do:

            if available(abss_det) then do:
               l_ship_id = substring(abss_ship_id,2,length(abss_ship_id)).
               put
                  space(40)
                  {gplblfmt.i
                     &FUNC=getTermLabel(""PICKED"",6)
                     &CONCAT="':'"}
                  space(1)
                  string(rcsd_picked)
                  space(5)
                  {gplblfmt.i
                     &FUNC=getTermLabelRt(""PRE-SHIPPER/SHIPPER"",24)
                     &CONCAT="':'"}
                  space(1)
                  l_ship_id
                  space(1)
                  {gplblfmt.i
                     &FUNC=getTermLabel(""CONFIRMED"",9)
                     &CONCAT="':'"}
                  space(1)
                  string(abss_confirmed).
            end.  /* if available(abss_det) */
            else
               put
                  space(40)
                  {gplblfmt.i
                     &FUNC=getTermLabel(""PICKED"",6)
                     &CONCAT="':'"}
                  space(1)
                  string(rcsd_picked).

            down 2.

         end.  /* if rcsd_picked  */

         else do:

            if rcsd_x_referenced then do:
               if available(rcsx_ref) then do:
                  put
                     space(5)
                     {gplblfmt.i
                        &FUNC=getTermLabel(""X-REFERENCED"",12)
                        &CONCAT="': '"}
                     space(1)
                     string(rcsd_x_referenced)
                     space(10)
                     {gplblfmt.i
                        &FUNC=getTermLabel(""RELEASE_ID"",10)
                        &CONCAT="': '"}
                     space(1)
                     rcsx_shipped_rlse_id
                     space(9)
                     {gplblfmt.i
                        &FUNC=getTermLabelRt(""JOB"",5)
                        &CONCAT="': '"}
                     space(1)
                     rcsx_shipped_cust_job
                     skip
                     space(81)
                     {gplblfmt.i
                        &FUNC=getTermLabelRt(""SEQUENCE"",12)
                        &CONCAT="': '"}
                     space(1)
                     rcsx_shipped_cust_seq.
               end.  /*if available(rcsx_ref) */
               else
                  put
                     space(5)
                     {gplblfmt.i
                        &FUNC=getTermLabel(""X-REFERENCED"",12)
                        &CONCAT="': '"}
                     space(1)
                     string(rcsd_x_referenced).

               down 2.

            end.  /* if rcsd_x_referenced  */

         end.  /* else do */

      end.  /* if ip_details */

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


   end. /* FOR EACH RCSD_DET */

END PROCEDURE. /*PRINT_DETAILS*/

PROCEDURE print_subtotals:
/*--------------------------------------------------------------------
  Purpose:
  Parameters:
  Notes:
 ----------------------------------------------------------------------*/
   define input parameter ip_sub_shipfrom like rcs_shipfrom no-undo.
   define input parameter ip_sub_shipto   like rcs_shipto   no-undo.
   define input parameter ip_sub_rlse     like rcs_rlse_id no-undo.
   define input parameter ip_total_parts  like mfc_logical no-undo.

   define variable l_discr_qty like rcsd_discr_qty no-undo.

   FORM /*GUI*/ 
      tt-date
      tt-part
      tt-pt-desc
      l_discr_qty column-label "Sub-Total!Qty"
   with STREAM-IO /*GUI*/  frame sub-totals down width 132.

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame sub-totals:handle).

   FORM /*GUI*/ 
      tt-prnt-date
      tt-prnt-part
      tt-prnt-desc
      tt-prnt-discr-qty column-label "Sub-Total!Qty"
   with STREAM-IO /*GUI*/  frame subs down width 132.

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame subs:handle).

   if not ip_total_parts then do:
      if can-find(first tt-sub-totals
                  where tt-shipfrom = ip_sub_shipfrom
                    and tt-shipto   = ip_sub_shipto
                    and tt-rlse-id  = ip_sub_rlse)
     then do:

         display
            getTermLabel("ITEM_SUB-TOTALS_BY_DATE", 35) format "x(35)" at 20
         with frame c STREAM-IO /*GUI*/ .

         for each tt-sub-totals no-lock
            where tt-shipfrom = ip_sub_shipfrom
              and tt-shipto   = ip_sub_shipto
              and tt-rlse-id  = ip_sub_rlse
         use-index tt-index2
         break by tt-date
               by tt-part
        with frame sub-totals:

            if first-of(tt-date) then
               display tt-date WITH STREAM-IO /*GUI*/ .

            assign
               l_discr_qty = l_discr_qty + tt-discr-qty
               l_total_discr_qty = tt-discr-qty + l_total_discr_qty.

            if last-of(tt-part) then do:

               display
                  tt-part
                  tt-pt-desc
                  l_discr_qty
                  tt-um WITH STREAM-IO /*GUI*/ .

               down.

               for first tt-prnt-sub
                   where tt-prnt-date = tt-date
                     and tt-prnt-part = tt-part
               no-lock: end.

               if not available tt-prnt-sub then do:
                  create tt-prnt-sub.
                  assign
                     tt-prnt-date = tt-date
                     tt-prnt-part = tt-part
                     tt-prnt-desc = tt-pt-desc
                     tt-prnt-um   = tt-um.
                  if recid(tt-prnt-sub) = -1 then.
               end. /* IF NOT AVAILABLE TT-PRNT-SUB */

               assign
                  tt-prnt-discr-qty = tt-prnt-discr-qty + l_total_discr_qty
                  l_discr_qty = 0
                  l_total_discr_qty = 0.

            end.

         end.

      end. /* IF CAN-FIND(FIRST TT-SUB-TOTALS */

   end.
   else
   if can-find(first tt-prnt-sub) then do:

      display
         skip (2)
         getTermLabel("ITEM_GRAND_TOTALS_BY_DATE", 35) format "x(35)" at 20 WITH STREAM-IO /*GUI*/ .

      for each tt-prnt-sub no-lock
      break by tt-prnt-date
      with frame subs:

         if first-of(tt-prnt-date) then
            display
               tt-prnt-date WITH STREAM-IO /*GUI*/ .

         display
            tt-prnt-part
            tt-prnt-desc
            tt-prnt-discr-qty
            tt-prnt-um WITH STREAM-IO /*GUI*/ .

         down 1.

      end.

   end.

END PROCEDURE. /*PRINT_SUBTOTALS*/
